package com.example.shushiyunsst.fragment.main.home.child.miner22.bean;

import android.text.TextUtils;

import com.alibaba.fastjson.annotation.JSONField;

import java.io.Serializable;

public class Miner22ShareBean implements Serializable {

    public static final int FANS = 0;

    public static final int REAL_NAME = 2;

    public static final int valid = 1;

    /**
     * account : 15101049578
     * level : 2
     * realName : null
     */

    @JSONField(name = "account")
    private String account;

    @JSONField(name = "level")
    private int level;

    @JSONField(name = "realName")
    private String realName;

    private String accountHid;

    public String getAccountHid() {
        if (!TextUtils.isEmpty(accountHid)) {
            return accountHid;
        }

        StringBuilder builder = new StringBuilder();

        String account = getAccount();

        if (TextUtils.isEmpty(account)) {
            return "";
        }

        String[] split = account.split("");
        int start = split.length > 4 ? 2 : 0;
        int end = split.length > 4 ? split.length - 4 : split.length;
        for (int i = 0; i < split.length; i++) {
            String str = split[i];
            if (i > start && i < end) {
                str = "*";
            }
            builder.append(str);
        }
        accountHid = builder.toString();
        return accountHid;
    }

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public String getRealName() {
//        if (TextUtils.isEmpty(realName)){
//            return "";
//        }
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }
}
